﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Collections;
using SYH.Utils;

namespace syh876.com.Controllers
{
    public class uploadController : Controller
    {
        /// <summary>
        /// 图片上传操作类
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            int size = 4; //文件大小限制,单位MB    

            string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp", ".swf", ".xlsx", ".xls" };         //文件允许格式

            //上传图片
            Hashtable info = new Hashtable();
            Uploader up = new Uploader();
            string pathbase = null;

            //int path = Convert.ToInt32(up.getOtherInfo(HttpContext.Request, "dir"));
            //if (path == 1)
            //{
            //    pathbase = "/upload/";
            //}

            //info = up.upFile(HttpContext.Server, HttpContext.Request, pathbase, filetype, size);   //获取上传状态

            //string title = up.getOtherInfo(HttpContext.Request, "pictitle");                   //获取图片描述
            //string oriName = up.getOtherInfo(HttpContext.Request, "fileName");                //获取原始文件名
            //string newName = up.FileName();  //存入数据库中的路径

            //return Content("{'url':'" + info["url"] + "','title':'" + title + "','newName':'" + newName + "','state':'" + info["state"] + "'}");
            return Content("");
        }

    }
}
